using System.Collections.Generic;
namespace Battle.TimelineLog
{
    /// <summary>
    /// 初始战斗参与者数据
    /// </summary>
    public class InitFighterData
    {
        public int HpMax;
        public int Hp;
        public int AtkSpd;
        public int Atk;
        public int Def;
        public int CritRate;
        public int CritHurt;
        public int ComboRate;
        public int DodgeRate;

        public List<SkillData> Skills;
        public int Side;
        public string SysId;
        public InitFighterData()
        {
            Skills = new List<SkillData>();
        }
        public InitFighterData(string heroId, int side)
        {
            Skills = new List<SkillData>();
            Reset(heroId, side);
        }
        public virtual void Reset(string heroId, int side, List<int> skillLevels = null, int crtHp = 0)
        {
            SysId = heroId;
            Side = side;
            // 需要自行修改设置初始化数据的方法
            var heorRes = SysDataMgr.Sys_Hero.GetData(heroId);
            HpMax = heorRes.prop.HpMax;
            if (crtHp > 0) Hp = crtHp;
            Atk = heorRes.prop.Atk;
            AtkSpd = heorRes.prop.AtkSpd;
            Def = heorRes.prop.Def;
            CritRate = heorRes.prop.Crit;
            CritHurt = heorRes.prop.CritHurt == 0 ? 200 : heorRes.prop.CritHurt;
            ComboRate = heorRes.prop.Combo;
            DodgeRate = heorRes.prop.Dodge;

            // skills
            Skills.Clear();
            for (int i = 0; i < heorRes.skills.Count; i++)
            {
                SkillData sd = new SkillData()
                {
                    sysId = heorRes.skills[i],
                    level = skillLevels == null ? 1 : skillLevels[i]
                };
                Skills.Add(sd);
            }
        }
    }
    public class SkillData
    {
        public string sysId;// 表格里的数据配置id
        public int level;// 技能的等级
    }
}